import { getStore } from '@/util/store'

const dic = {
  eliminateType: [
    { label: '取消物料供货资格', value: '1' },
    { label: '合格供应商降级', value: '2' },
    { label: '加入黑名单', value: '3' }
  ],
  supplierType: [
    {
      label: 'xxx',
      value: '1'
    }
  ],
  supplierDemote: [
    {
      label: '注册',
      value: '0'
    },
    {
      label: '推荐',
      value: '1'
    }
  ],
  demoteReason: [
    {
      label: 'xxx',
      value: '0'
    }
  ],
  isUnpaidOrder: [
    {
      label: '是',
      value: '1'
    },
    {
      label: '否',
      value: '2'
    }
  ]
}

export const option = function () {
  return {
    labelWidth: 120,
    emptyBtn: false,
    submitBtn: false,
    detail: ['view'].includes(this.type),
    column: [
      {
        label: '样品名称',
        span: 8,
        prop: 'sampleName',
        maxlength: 100,
        rules: [
          {
            required: true,
            message: '请输入样品名称',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '供应商名称',
        prop: 'supplierName',
        formslot: true,
        span: 8,
        maxlength: 50,
        rules: [
          {
            required: true,
            message: '请选择供应商名称',
            trigger: 'change'
          }
        ]
      },

      {
        label: '物料分类',
        prop: 'materialCategory',
        formslot: true,
        display: true,
        span: 8,
        rules: [
          {
            required: true,
            message: '请选择物料分类',
            trigger: 'change'
          }
        ]
      },
      {
        label: '样品规格',
        prop: 'sampleSpecs',
        span: 8,
        maxlength: 50,
        rules: [
          {
            required: true,
            message: '请输入样品规格',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '样品单位',
        prop: 'sampleUnit',
        span: 8,
        maxlength: 50,
        rules: [
          {
            required: true,
            message: '请输入样品单位',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '样品数量',
        prop: 'sampleNum',
        span: 8,
        maxlength: 50,
        rules: [
          {
            required: true,
            message: '请输入样品数量',
            trigger: 'blur'
          }
        ]
      },
      {
        label: '样本用途',
        prop: 'sampleRemark',
        type: 'textarea',
        placeholder: '',
        maxlength: 500,
        minRows: 4,
        maxRows: 6,
        span: 24
      },
      {
        label: '样品编号',
        prop: 'sampleCode',
        disabled: true,
        maxlength: 50,
        span:8
      },
      {
        label: '申请人',
        span: 8,
        prop: 'applyPerson',
        maxlength: 100,
        disabled: true,
        value: getStore({ name: 'userInfo' }).user_name
      },
      {
        label: '申请日期',
        span: 8,
        prop: 'applyDate',
        type: 'date',
        format: 'yyyy-MM-dd',
        valueFormat: 'yyyy-MM-dd',
        maxlength: 100,
        disabled: true,
        value: new Date()
      }
    ]
  }
}

export const supplierOption = [
  { label: '选择', prop: 'radio', width: 50 },
  { label: '供应商编码', prop: 'supplierCode' },
  { label: '供应商名称', prop: 'supplierName' },
  { label: '供应商类型', prop: 'supplierType' },
  { label: '供应商身份', prop: 'supplierIdentity' }
]
